package com.ruoyi.manage.domain;

import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 面试时间段对象 cr_interview_slot
 */
public class CrInterviewSlot extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 时间段ID */
    private Long slotId;

    /** 社团ID */
    @Excel(name = "社团ID")
    private Long clubId;

    /** 招聘ID */
    @Excel(name = "招聘ID")
    private Long recruitmentId;

    /** 面试日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "面试日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date interviewDate;

    /** 开始时间 */
    @Excel(name = "开始时间")
    private String startTime;

    /** 结束时间 */
    @Excel(name = "结束时间")
    private String endTime;

    /** 面试地点 */
    @Excel(name = "面试地点")
    private String location;

    /** 面试官 */
    @Excel(name = "面试官")
    private String interviewer;

    /** 最大面试人数 */
    @Excel(name = "最大面试人数")
    private Integer maxApplicants;

    /** 已预约人数 */
    @Excel(name = "已预约人数")
    private Integer bookedCount;

    /** 状态（0可用 1不可用） */
    @Excel(name = "状态", readConverterExp = "0=可用,1=不可用")
    private String status;

    /** 备注说明 */
    @Excel(name = "备注说明")
    private String notes;

    // 关联查询字段
    /** 社团名称 */
    private String clubName;

    /** 招聘标题 */
    private String recruitmentTitle;

    /** 岗位名称 */
    private String positionName;

    /** 剩余名额 */
    private Integer availableCount;

    /** 是否可预约 */
    private Boolean canBook;

    /** 面试类型 */
    private String interviewType;

    public void setSlotId(Long slotId)
    {
        this.slotId = slotId;
    }

    public Long getSlotId()
    {
        return slotId;
    }

    public void setClubId(Long clubId)
    {
        this.clubId = clubId;
    }

    public Long getClubId()
    {
        return clubId;
    }

    public void setRecruitmentId(Long recruitmentId)
    {
        this.recruitmentId = recruitmentId;
    }

    public Long getRecruitmentId()
    {
        return recruitmentId;
    }

    public void setInterviewDate(Date interviewDate)
    {
        this.interviewDate = interviewDate;
    }

    public Date getInterviewDate()
    {
        return interviewDate;
    }

    public void setStartTime(String startTime)
    {
        this.startTime = startTime;
    }

    public String getStartTime()
    {
        return startTime;
    }

    public void setEndTime(String endTime)
    {
        this.endTime = endTime;
    }

    public String getEndTime()
    {
        return endTime;
    }

    public void setLocation(String location)
    {
        this.location = location;
    }

    public String getLocation()
    {
        return location;
    }

    public void setInterviewer(String interviewer)
    {
        this.interviewer = interviewer;
    }

    public String getInterviewer()
    {
        return interviewer;
    }

    public void setMaxApplicants(Integer maxApplicants)
    {
        this.maxApplicants = maxApplicants;
    }

    public Integer getMaxApplicants()
    {
        return maxApplicants;
    }

    public void setBookedCount(Integer bookedCount)
    {
        this.bookedCount = bookedCount;
    }

    public Integer getBookedCount()
    {
        return bookedCount;
    }

    public void setStatus(String status)
    {
        this.status = status;
    }

    public String getStatus()
    {
        return status;
    }

    public void setNotes(String notes)
    {
        this.notes = notes;
    }

    public String getNotes()
    {
        return notes;
    }

    public String getClubName()
    {
        return clubName;
    }

    public void setClubName(String clubName)
    {
        this.clubName = clubName;
    }

    public String getRecruitmentTitle()
    {
        return recruitmentTitle;
    }

    public void setRecruitmentTitle(String recruitmentTitle)
    {
        this.recruitmentTitle = recruitmentTitle;
    }

    public String getPositionName()
    {
        return positionName;
    }

    public void setPositionName(String positionName)
    {
        this.positionName = positionName;
    }

    public Integer getAvailableCount()
    {
        if (maxApplicants != null && bookedCount != null) {
            return maxApplicants - bookedCount;
        }
        return null;
    }

    public void setAvailableCount(Integer availableCount)
    {
        this.availableCount = availableCount;
    }

    public Boolean getCanBook()
    {
        if ("1".equals(status)) {
            return false; // 不可用状态
        }
        if (maxApplicants != null && bookedCount != null) {
            return bookedCount < maxApplicants;
        }
        return true;
    }

    public void setCanBook(Boolean canBook)
    {
        this.canBook = canBook;
    }

    public String getInterviewType()
    {
        return interviewType;
    }

    public void setInterviewType(String interviewType)
    {
        this.interviewType = interviewType;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
            .append("slotId", getSlotId())
            .append("clubId", getClubId())
            .append("recruitmentId", getRecruitmentId())
            .append("interviewDate", getInterviewDate())
            .append("startTime", getStartTime())
            .append("endTime", getEndTime())
            .append("location", getLocation())
            .append("interviewer", getInterviewer())
            .append("maxApplicants", getMaxApplicants())
            .append("bookedCount", getBookedCount())
            .append("status", getStatus())
            .append("notes", getNotes())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .toString();
    }
}